package mylibrary.reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;

public class TestMethodDifference {

	public static void main(String[] args) throws Exception {
		
		Class user = User.class;
		
		Field[] fields = user.getFields();
		for(int i=0; i<fields.length; i++) {
			System.out.print(fields[i].getName() + "," + Modifier.toString(fields[i].getModifiers())+ "," +
					fields[i].getType() + "|");	
		}
		
		System.out.println();
		
		Field[] declaredFields = user.getDeclaredFields(); 
		for(int i=0; i<declaredFields.length; i++) {
			System.out.print(declaredFields[i].getName() + " ");	
		}
		
		System.out.println();
		
		Method[] methods = user.getMethods();
		for(int i=0; i<methods.length; i++) {
			System.out.print(methods[i].getName() + " ");	
		}
		
		System.out.println();
		
		Method[] declaredMethods = user.getDeclaredMethods();
		for(int i=0; i<declaredMethods.length; i++) {
			System.out.print(declaredMethods[i].getName() + " ");	
		}
		
		System.out.println();
		
		Constructor[] constructors = user.getConstructors();
		for(int i=0; i<constructors.length; i++) {
			System.out.print(constructors[i].getName() + " " + constructors[i].getParameterTypes() + "|");	
		}
		
		System.out.println();
		
		Constructor[] declaredConstructors = user.getDeclaredConstructors();
		for(int i=0; i<declaredConstructors.length; i++) {
			System.out.print(declaredConstructors[i].getName() + " " + declaredConstructors[i].getParameterTypes() + "|");	
		}
	}
}
